/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdministratorHomeView.java
 *
 * Created on Mar 31, 2010, 5:14:50 PM
 */

package ticketmaster.presentation.administrator;
import java.sql.SQLException;
import javax.swing.*;

import java.text.ParseException;
import java.util.*;
import java.util.logging.*;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
import javax.sql.RowSet;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import ticketmaster.businesslogic.*;
import ticketmaster.dao.*;
import ticketmaster.dataobject.*;
import ticketmaster.email.*;
import ticketmaster.presentation.BaseFrame;
import ticketmaster.util.StringHelper;

/**
 *
 * @author Wei Liu
 */
public class AdministratorHomeView extends BaseFrame {
    private int traceSeatCategory;

    /** Creates new form AdministratorHomeView */
    public AdministratorHomeView() {
        initComponents();
        initDropDownList();
        initCancelEventComponent(); // added by xiaolong xue
        initAddVenue();
        init();
    }

    public void init()
    {
        this.cbSelect.setVisible(false);
       
        this.ffA.setVisible(false);
        this.ffB.setVisible(false);
        this.ffC.setVisible(false);
        this.ffD.setVisible(false);
        this.ffE.setVisible(false);
        this.ckbA.setVisible(false);
        this.ckbB.setVisible(false);
        this.ckbC.setVisible(false);
        this.ckbD.setVisible(false);
        this.ckbE.setVisible(false);
        this.cmbEvent.setVisible(false);

        this.ffA.setText("");
        this.ffB.setText("");
        this.ffC.setText("");
        this.ffD.setText("");
        this.ffE.setText("");
        this.tffrom.setVisible(false);
        this.tfto.setVisible(false);
        this.lbFromdate.setVisible(false);
        this.lbTodate.setVisible(false);
        this.lbyy.setVisible(false);
        this.lbxx1.setVisible(false);

    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        bAddVenue = new javax.swing.JButton();
        bReset = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        tfVenueName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        tfVenueLocation = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        tfVenueType = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        lb1 = new javax.swing.JLabel();
        ffA1 = new javax.swing.JTextField();
        lb2 = new javax.swing.JLabel();
        ffB1 = new javax.swing.JTextField();
        lb3 = new javax.swing.JLabel();
        ffC1 = new javax.swing.JTextField();
        lb4 = new javax.swing.JLabel();
        ffD1 = new javax.swing.JTextField();
        lb5 = new javax.swing.JLabel();
        ffE1 = new javax.swing.JTextField();
        bAddSeat = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        lbEventName = new javax.swing.JLabel();
        tfEventName = new javax.swing.JTextField();
        lbdisplay1 = new javax.swing.JLabel();
        tfStartDate = new javax.swing.JFormattedTextField();
        lbStartDate = new javax.swing.JLabel();
        lbStartTime = new javax.swing.JLabel();
        tfStartTime = new javax.swing.JFormattedTextField();
        lbEndDate = new javax.swing.JLabel();
        tfEndDate = new javax.swing.JFormattedTextField();
        lbdisplay3 = new javax.swing.JLabel();
        lbdisplay2 = new javax.swing.JLabel();
        lbdisplay4 = new javax.swing.JLabel();
        tfEndTime = new javax.swing.JFormattedTextField();
        lbEndTime = new javax.swing.JLabel();
        lbType1 = new javax.swing.JLabel();
        tfType1 = new javax.swing.JFormattedTextField();
        tfKeyword = new javax.swing.JFormattedTextField();
        lbKeyword = new javax.swing.JLabel();
        cbVenue = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        taDescription = new javax.swing.JTextArea();
        lbDescription = new javax.swing.JLabel();
        bAdd = new javax.swing.JButton();
        lbVenue = new javax.swing.JLabel();
        btReset = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        ckbA = new javax.swing.JLabel();
        ckbB = new javax.swing.JLabel();
        ckbC = new javax.swing.JLabel();
        ckbD = new javax.swing.JLabel();
        ckbE = new javax.swing.JLabel();
        ffC = new javax.swing.JTextField();
        ffA = new javax.swing.JTextField();
        ffD = new javax.swing.JTextField();
        ffE = new javax.swing.JTextField();
        ffB = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        cbBase = new javax.swing.JComboBox();
        cbSelect = new javax.swing.JComboBox();
        bGenerate = new javax.swing.JButton();
        lbReport = new javax.swing.JLabel();
        lbSelect = new javax.swing.JLabel();
        lbFrequency = new javax.swing.JLabel();
        cbFrequency = new javax.swing.JComboBox();
        lbTodate = new javax.swing.JLabel();
        lbFromdate = new javax.swing.JLabel();
        tfto = new javax.swing.JTextField();
        tffrom = new javax.swing.JTextField();
        lbyy = new javax.swing.JLabel();
        lbxx1 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        lsSelect = new javax.swing.JList();
        lbBase = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        cmbEvent = new javax.swing.JComboBox();
        btnCancelEvent = new javax.swing.JButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        lscnEvent = new javax.swing.JList();
        lbcn = new javax.swing.JLabel();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(ticketmaster.TicketMasterApp.class).getContext().getResourceMap(AdministratorHomeView.class);
        jTabbedPane1.setBackground(resourceMap.getColor("jTabbedPane1.background")); // NOI18N
        jTabbedPane1.setFont(resourceMap.getFont("jTabbedPane1.font")); // NOI18N
        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setBackground(resourceMap.getColor("jPanel1.background")); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        bAddVenue.setFont(resourceMap.getFont("bReset.font")); // NOI18N
        bAddVenue.setText(resourceMap.getString("bAddVenue.text")); // NOI18N
        bAddVenue.setName("bAddVenue"); // NOI18N
        bAddVenue.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAddVenueActionPerformed(evt);
            }
        });
        jPanel1.add(bAddVenue, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 380, 110, 40));

        bReset.setFont(resourceMap.getFont("bReset.font")); // NOI18N
        bReset.setText(resourceMap.getString("bReset.text")); // NOI18N
        bReset.setName("bReset"); // NOI18N
        bReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bResetActionPerformed(evt);
            }
        });
        jPanel1.add(bReset, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 380, 110, 40));

        jPanel5.setBackground(resourceMap.getColor("addvenue.background")); // NOI18N
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("addvenue.border.border.lineColor")), resourceMap.getString("addvenue.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("addvenue.border.titleFont"))); // NOI18N
        jPanel5.setFont(resourceMap.getFont("addvenue.font")); // NOI18N
        jPanel5.setName("addvenue"); // NOI18N
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setText(resourceMap.getString("lbVenueName.text")); // NOI18N
        jLabel2.setName("lbVenueName"); // NOI18N
        jPanel5.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 36, 76, 20));

        tfVenueName.setText(resourceMap.getString("tfVenueName.text")); // NOI18N
        tfVenueName.setName("tfVenueName"); // NOI18N
        tfVenueName.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tfVenueNameFocusLost(evt);
            }
        });
        jPanel5.add(tfVenueName, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 36, 121, -1));

        jLabel3.setText(resourceMap.getString("lbVenueLocation.text")); // NOI18N
        jLabel3.setName("lbVenueLocation"); // NOI18N
        jPanel5.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 87, -1, 26));

        tfVenueLocation.setText(resourceMap.getString("tfVenueLocation.text")); // NOI18N
        tfVenueLocation.setName("tfVenueLocation"); // NOI18N
        tfVenueLocation.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tfVenueLocationFocusLost(evt);
            }
        });
        jPanel5.add(tfVenueLocation, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 90, 120, -1));

        jLabel4.setText(resourceMap.getString("lbVenueType.text")); // NOI18N
        jLabel4.setName("lbVenueType"); // NOI18N
        jPanel5.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 156, 89, 23));

        tfVenueType.setText(resourceMap.getString("tfVenueType.text")); // NOI18N
        tfVenueType.setName("tfVenueType"); // NOI18N
        tfVenueType.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                tfVenueTypeFocusLost(evt);
            }
        });
        jPanel5.add(tfVenueType, new org.netbeans.lib.awtextra.AbsoluteConstraints(109, 157, 122, -1));

        jLabel12.setForeground(resourceMap.getColor("lbLimit1.foreground")); // NOI18N
        jLabel12.setText(resourceMap.getString("lbLimit1.text")); // NOI18N
        jLabel12.setName("lbLimit1"); // NOI18N
        jPanel5.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 60, 170, -1));

        jLabel13.setForeground(resourceMap.getColor("lbLimit2.foreground")); // NOI18N
        jLabel13.setText(resourceMap.getString("lbLimit2.text")); // NOI18N
        jLabel13.setName("lbLimit2"); // NOI18N
        jPanel5.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 110, 139, -1));

        jLabel14.setForeground(resourceMap.getColor("lbInteger.foreground")); // NOI18N
        jLabel14.setText(resourceMap.getString("lbInteger.text")); // NOI18N
        jLabel14.setName("lbInteger"); // NOI18N
        jPanel5.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 180, 120, -1));

        jPanel1.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, 350, 300));
        jPanel5.getAccessibleContext().setAccessibleName(resourceMap.getString("jPanel5.AccessibleContext.accessibleName")); // NOI18N

        jPanel6.setBackground(resourceMap.getColor("jPanel6.background")); // NOI18N
        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("jPanel6.border.border.lineColor")), resourceMap.getString("jPanel6.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel6.border.titleFont"))); // NOI18N
        jPanel6.setFont(resourceMap.getFont("jPanel6.font")); // NOI18N
        jPanel6.setName("jPanel6"); // NOI18N

        jLabel5.setText(resourceMap.getString("lbNumber.text")); // NOI18N
        jLabel5.setName("lbNumber"); // NOI18N

        lb1.setText(resourceMap.getString("lb1.text")); // NOI18N
        lb1.setName("lb1"); // NOI18N

        ffA1.setText(resourceMap.getString("ffA1.text")); // NOI18N
        ffA1.setName("ffA1"); // NOI18N
        ffA1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ffA1FocusLost(evt);
            }
        });

        lb2.setText(resourceMap.getString("lb2.text")); // NOI18N
        lb2.setName("lb2"); // NOI18N

        ffB1.setText(resourceMap.getString("ffB1.text")); // NOI18N
        ffB1.setName("ffB1"); // NOI18N
        ffB1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ffB1ActionPerformed(evt);
            }
        });
        ffB1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ffB1FocusLost(evt);
            }
        });

        lb3.setText(resourceMap.getString("lb3.text")); // NOI18N
        lb3.setName("lb3"); // NOI18N

        ffC1.setText(resourceMap.getString("ffC1.text")); // NOI18N
        ffC1.setName("ffC1"); // NOI18N
        ffC1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ffC1FocusLost(evt);
            }
        });

        lb4.setText(resourceMap.getString("lb4.text")); // NOI18N
        lb4.setName("lb4"); // NOI18N

        ffD1.setText(resourceMap.getString("ffD1.text")); // NOI18N
        ffD1.setName("ffD1"); // NOI18N
        ffD1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ffD1FocusLost(evt);
            }
        });

        lb5.setText(resourceMap.getString("lb5.text")); // NOI18N
        lb5.setName("lb5"); // NOI18N

        ffE1.setText(resourceMap.getString("ffE1.text")); // NOI18N
        ffE1.setName("ffE1"); // NOI18N
        ffE1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                ffE1FocusLost(evt);
            }
        });

        bAddSeat.setFont(resourceMap.getFont("bReset.font")); // NOI18N
        bAddSeat.setText(resourceMap.getString("bAddSeat.text")); // NOI18N
        bAddSeat.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        bAddSeat.setName("bAddSeat"); // NOI18N
        bAddSeat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAddSeatActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(lb5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(ffE1))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(lb4, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(ffD1))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lb1)
                                    .addComponent(lb2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lb3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(ffB1, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)
                                    .addComponent(ffC1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
                                    .addComponent(ffA1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)))
                            .addComponent(bAddSeat, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(38, 38, 38))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb1)
                    .addComponent(ffA1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ffB1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ffC1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb4)
                    .addComponent(ffD1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb5, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ffE1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
                .addComponent(bAddSeat, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel1.add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 60, 400, 300));

        jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

        jPanel2.setBackground(resourceMap.getColor("jPanel2.background")); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel7.setBackground(resourceMap.getColor("jPanel7.background")); // NOI18N
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("jPanel7.border.border.lineColor")), resourceMap.getString("jPanel7.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel7.border.titleFont"))); // NOI18N
        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lbEventName.setText(resourceMap.getString("lbEventName.text")); // NOI18N
        lbEventName.setName("lbEventName"); // NOI18N
        jPanel7.add(lbEventName, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 80, 60, 25));

        tfEventName.setText(resourceMap.getString("tfEventName.text")); // NOI18N
        tfEventName.setName("tfEventName"); // NOI18N
        tfEventName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfEventNameActionPerformed(evt);
            }
        });
        jPanel7.add(tfEventName, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 80, 201, -1));

        lbdisplay1.setForeground(resourceMap.getColor("lbdisplay1.foreground")); // NOI18N
        lbdisplay1.setText(resourceMap.getString("lbdisplay1.text")); // NOI18N
        lbdisplay1.setName("lbdisplay1"); // NOI18N
        jPanel7.add(lbdisplay1, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 110, -1, 25));

        tfStartDate.setText(resourceMap.getString("tfStartDate.text")); // NOI18N
        tfStartDate.setName("tfStartDate"); // NOI18N
        jPanel7.add(tfStartDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 110, 201, -1));

        lbStartDate.setText(resourceMap.getString("lbStartDate.text")); // NOI18N
        lbStartDate.setName("lbStartDate"); // NOI18N
        jPanel7.add(lbStartDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 110, 60, 25));

        lbStartTime.setText(resourceMap.getString("lbStartTime.text")); // NOI18N
        lbStartTime.setName("lbStartTime"); // NOI18N
        jPanel7.add(lbStartTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 140, 60, 25));

        tfStartTime.setName("tfStartTime"); // NOI18N
        jPanel7.add(tfStartTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 140, 201, -1));

        lbEndDate.setText(resourceMap.getString("lbEndDate.text")); // NOI18N
        lbEndDate.setName("lbEndDate"); // NOI18N
        jPanel7.add(lbEndDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 170, 60, 25));

        tfEndDate.setText(resourceMap.getString("tfEndDate.text")); // NOI18N
        tfEndDate.setName("tfEndDate"); // NOI18N
        jPanel7.add(tfEndDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 170, 201, -1));

        lbdisplay3.setForeground(resourceMap.getColor("lbdisplay3.foreground")); // NOI18N
        lbdisplay3.setText(resourceMap.getString("lbdisplay3.text")); // NOI18N
        lbdisplay3.setName("lbdisplay3"); // NOI18N
        jPanel7.add(lbdisplay3, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 170, -1, 25));

        lbdisplay2.setForeground(resourceMap.getColor("lbdisplay2.foreground")); // NOI18N
        lbdisplay2.setText(resourceMap.getString("lbdisplay2.text")); // NOI18N
        lbdisplay2.setName("lbdisplay2"); // NOI18N
        jPanel7.add(lbdisplay2, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 140, 76, 25));

        lbdisplay4.setForeground(resourceMap.getColor("lbdisplay4.foreground")); // NOI18N
        lbdisplay4.setText(resourceMap.getString("lbdisplay4.text")); // NOI18N
        lbdisplay4.setName("lbdisplay4"); // NOI18N
        jPanel7.add(lbdisplay4, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 200, -1, 25));

        tfEndTime.setName("tfEndTime"); // NOI18N
        jPanel7.add(tfEndTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 200, 201, -1));

        lbEndTime.setText(resourceMap.getString("lbEndTime.text")); // NOI18N
        lbEndTime.setName("lbEndTime"); // NOI18N
        jPanel7.add(lbEndTime, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 200, 60, 25));

        lbType1.setText(resourceMap.getString("lbType1.text")); // NOI18N
        lbType1.setName("lbType1"); // NOI18N
        jPanel7.add(lbType1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 230, -1, -1));

        tfType1.setName("tfType1"); // NOI18N
        jPanel7.add(tfType1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 230, 201, -1));

        tfKeyword.setText(resourceMap.getString("tfKeyword.text")); // NOI18N
        tfKeyword.setName("tfKeyword"); // NOI18N
        jPanel7.add(tfKeyword, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 260, 201, -1));

        lbKeyword.setText(resourceMap.getString("lbKeyword.text")); // NOI18N
        lbKeyword.setName("lbKeyword"); // NOI18N
        jPanel7.add(lbKeyword, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 260, -1, -1));

        cbVenue.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        cbVenue.setName("cbVenue"); // NOI18N
        cbVenue.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbVenueActionPerformed(evt);
            }
        });
        jPanel7.add(cbVenue, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 300, 201, -1));

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        taDescription.setColumns(20);
        taDescription.setRows(5);
        taDescription.setName("taDescription"); // NOI18N
        jScrollPane1.setViewportView(taDescription);

        jPanel7.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 350, 201, 81));

        lbDescription.setText(resourceMap.getString("lbDescription.text")); // NOI18N
        lbDescription.setName("lbDescription"); // NOI18N
        jPanel7.add(lbDescription, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 350, 75, 25));

        bAdd.setText(resourceMap.getString("bAdd.text")); // NOI18N
        bAdd.setName("bAdd"); // NOI18N
        bAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bAddActionPerformed(evt);
            }
        });
        jPanel7.add(bAdd, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 450, 90, 30));

        lbVenue.setText(resourceMap.getString("lbVenue.text")); // NOI18N
        lbVenue.setName("lbVenue"); // NOI18N
        jPanel7.add(lbVenue, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 300, 50, 25));

        btReset.setText(resourceMap.getString("btReset.text")); // NOI18N
        btReset.setName("btReset"); // NOI18N
        btReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btResetActionPerformed(evt);
            }
        });
        jPanel7.add(btReset, new org.netbeans.lib.awtextra.AbsoluteConstraints(221, 450, 90, 30));

        jPanel2.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, 510, 500));

        jPanel8.setBackground(resourceMap.getColor("jPanel8.background")); // NOI18N
        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(resourceMap.getColor("jPanel8.border.border.lineColor")), resourceMap.getString("jPanel8.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, resourceMap.getFont("jPanel8.border.titleFont"), resourceMap.getColor("jPanel8.border.titleColor"))); // NOI18N
        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        ckbA.setFont(resourceMap.getFont("ckbA.font")); // NOI18N
        ckbA.setText(resourceMap.getString("ckbA.text")); // NOI18N
        ckbA.setName("ckbA"); // NOI18N
        jPanel8.add(ckbA, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 80, 30, 20));

        ckbB.setFont(resourceMap.getFont("ckbB.font")); // NOI18N
        ckbB.setText(resourceMap.getString("ckbB.text")); // NOI18N
        ckbB.setName("ckbB"); // NOI18N
        jPanel8.add(ckbB, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 130, 30, 20));

        ckbC.setFont(resourceMap.getFont("ckbC.font")); // NOI18N
        ckbC.setText(resourceMap.getString("ckbC.text")); // NOI18N
        ckbC.setName("ckbC"); // NOI18N
        jPanel8.add(ckbC, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 180, 30, 20));

        ckbD.setFont(resourceMap.getFont("ckbD.font")); // NOI18N
        ckbD.setText(resourceMap.getString("ckbD.text")); // NOI18N
        ckbD.setName("ckbD"); // NOI18N
        jPanel8.add(ckbD, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 230, 30, 20));

        ckbE.setFont(resourceMap.getFont("ckbE.font")); // NOI18N
        ckbE.setText(resourceMap.getString("ckbE.text")); // NOI18N
        ckbE.setName("ckbE"); // NOI18N
        jPanel8.add(ckbE, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 280, 30, 20));

        ffC.setText(resourceMap.getString("ffC.text")); // NOI18N
        ffC.setName("ffC"); // NOI18N
        jPanel8.add(ffC, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 180, 100, -1));

        ffA.setName("ffA"); // NOI18N
        jPanel8.add(ffA, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 80, 100, -1));

        ffD.setName("ffD"); // NOI18N
        jPanel8.add(ffD, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 230, 100, -1));

        ffE.setName("ffE"); // NOI18N
        jPanel8.add(ffE, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 280, 100, -1));

        ffB.setName("ffB"); // NOI18N
        jPanel8.add(ffB, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 130, 100, -1));

        jPanel2.add(jPanel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 30, 380, 500));

        jTabbedPane1.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jPanel4.setBackground(resourceMap.getColor("jPanel4.background")); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        cbBase.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "Event", "Venue", "Location", "Customer" }));
        cbBase.setName("cbBase"); // NOI18N
        cbBase.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbBaseActionPerformed(evt);
            }
        });
        jPanel4.add(cbBase, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 10, 100, -1));

        cbSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "" }));
        cbSelect.setEnabled(false);
        cbSelect.setName("cbSelect"); // NOI18N
        jPanel4.add(cbSelect, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 10, 760, -1));

        bGenerate.setText(resourceMap.getString("bGenerate.text")); // NOI18N
        bGenerate.setName("bGenerate"); // NOI18N
        bGenerate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bGenerateActionPerformed(evt);
            }
        });
        jPanel4.add(bGenerate, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 550, 160, 40));

        lbReport.setText(resourceMap.getString("lbReport.text")); // NOI18N
        lbReport.setName("lbReport"); // NOI18N
        jPanel4.add(lbReport, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 50, 360, 21));

        lbSelect.setText(resourceMap.getString("lbSelect.text")); // NOI18N
        lbSelect.setName("lbSelect"); // NOI18N
        jPanel4.add(lbSelect, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 220, 21));

        lbFrequency.setText(resourceMap.getString("lbFrequency.text")); // NOI18N
        lbFrequency.setName("lbFrequency"); // NOI18N
        jPanel4.add(lbFrequency, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, 60, 21));

        cbFrequency.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "Daily", "Monthly", "Yearly", "Custom" }));
        cbFrequency.setName("cbFrequency"); // NOI18N
        cbFrequency.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbFrequencyActionPerformed(evt);
            }
        });
        jPanel4.add(cbFrequency, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 10, 100, -1));

        lbTodate.setText(resourceMap.getString("lbTodate.text")); // NOI18N
        lbTodate.setName("lbTodate"); // NOI18N
        jPanel4.add(lbTodate, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 40, 60, -1));

        lbFromdate.setText(resourceMap.getString("lbFromdate.text")); // NOI18N
        lbFromdate.setName("lbFromdate"); // NOI18N
        jPanel4.add(lbFromdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 40, 50, -1));

        tfto.setText(resourceMap.getString("tfto.text")); // NOI18N
        tfto.setToolTipText(resourceMap.getString("tfto.toolTipText")); // NOI18N
        tfto.setName("tfto"); // NOI18N
        jPanel4.add(tfto, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 40, 100, -1));
        tfto.getAccessibleContext().setAccessibleName(resourceMap.getString("tfto.AccessibleContext.accessibleName")); // NOI18N

        tffrom.setName("tffrom"); // NOI18N
        jPanel4.add(tffrom, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 40, 100, -1));

        lbyy.setForeground(resourceMap.getColor("lbyy.foreground")); // NOI18N
        lbyy.setText(resourceMap.getString("lbyy.text")); // NOI18N
        lbyy.setName("lbyy"); // NOI18N
        jPanel4.add(lbyy, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 60, -1, -1));

        lbxx1.setFont(resourceMap.getFont("lbxx1.font")); // NOI18N
        lbxx1.setForeground(resourceMap.getColor("lbxx1.foreground")); // NOI18N
        lbxx1.setText(resourceMap.getString("lbxx1.text")); // NOI18N
        lbxx1.setName("lbxx1"); // NOI18N
        jPanel4.add(lbxx1, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 60, -1, -1));

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        lsSelect.setModel(cbSelect.getModel());
        lsSelect.setName("lsSelect"); // NOI18N
        jScrollPane4.setViewportView(lsSelect);

        jPanel4.add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 90, 390, 450));

        lbBase.setText(resourceMap.getString("lbBase.text")); // NOI18N
        lbBase.setName("lbBase"); // NOI18N
        jPanel4.add(lbBase, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, 21));

        jTabbedPane1.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

        jPanel3.setBackground(resourceMap.getColor("jPanel3.background")); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        cmbEvent.setFont(resourceMap.getFont("cmbEvent.font")); // NOI18N
        cmbEvent.setEnabled(false);
        cmbEvent.setName("cmbEvent"); // NOI18N
        jPanel3.add(cmbEvent, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 19, 86, 35));

        btnCancelEvent.setFont(resourceMap.getFont("btnCancelEvent.font")); // NOI18N
        btnCancelEvent.setText(resourceMap.getString("btnCancelEvent.text")); // NOI18N
        btnCancelEvent.setName("btnCancelEvent"); // NOI18N
        btnCancelEvent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelEventActionPerformed(evt);
            }
        });
        jPanel3.add(btnCancelEvent, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 540, 190, 40));

        jScrollPane5.setName("jScrollPane5"); // NOI18N

        lscnEvent.setModel(cmbEvent.getModel());
        lscnEvent.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        lscnEvent.setName("lscnEvent"); // NOI18N
        jScrollPane5.setViewportView(lscnEvent);

        jPanel3.add(jScrollPane5, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 70, 583, 453));

        lbcn.setFont(resourceMap.getFont("lbcn.font")); // NOI18N
        lbcn.setText(resourceMap.getString("lbcn.text")); // NOI18N
        lbcn.setName("lbcn"); // NOI18N
        jPanel3.add(lbcn, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 30, 242, 27));

        jTabbedPane1.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 633, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tfEventNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfEventNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tfEventNameActionPerformed

    private void bAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddActionPerformed
        // TODO add your handling code here:
        String str;
        int newid;
        if(!StringHelper.validateString(this.tfEventName.getText()))
        {
            JOptionPane.showMessageDialog(this, "Invalid characters in Name");
        }
        else if(StringHelper.limit(this.tfEventName.getText()))
        {
            JOptionPane.showMessageDialog(this, "Event name cannot be greater than 45 characters, Please re-enter");
            this.tfEventName.setText("");
        }
        else if(StringHelper.limit(this.tfKeyword.getText()))
        {
            JOptionPane.showMessageDialog(this, "Keyword cannot be greater than 45 characters, Please re-enter");
            this.tfKeyword.setText("");
        }
        else if(this.tfEventName.getText().equals("") || this.tfStartDate.getText().equals("") || this.tfStartTime.getText().equals("")
                || this.tfStartDate.getText().equals("") || this.tfEndTime.getText().equals("")
                || this.taDescription.getText().isEmpty() || this.tfKeyword.getText().isEmpty()
                || this.tfType1.getText().isEmpty())
        {
            JOptionPane.showMessageDialog(this, "All fields are mandatory");
        }
        else if(!StringHelper.isValidDate(this.tfStartDate.getText()))
        {
            JOptionPane.showMessageDialog(this, "Please enter proper Start Date");
        }
        else if(!StringHelper.isValidTime(this.tfStartTime.getText()))
        {
            JOptionPane.showMessageDialog(this, "Please enter proper Start Time");
        }
        else if(!StringHelper.isValidDate(this.tfEndDate.getText()))
        {
            JOptionPane.showMessageDialog(this, "Please enter proper End Date");
        }
        else if(!StringHelper.isValidTime(this.tfEndTime.getText()))
        {
            JOptionPane.showMessageDialog(this, "Please entere proper End time");
        }
        else try {
            if (!comparedates()) {
                JOptionPane.showMessageDialog(this, "Start date-time cannot be greater than End date-time");
            }
            else if (!compareschedule())
            {
                JOptionPane.showMessageDialog(this, "The venue is already booked at this date-time, please" +
                        " select some other date-time");
            }
            else if (this.cbVenue.getSelectedItem().equals("")) {
                JOptionPane.showMessageDialog(this, "Please select venue");
            } else if (!validateTicketRate()) {
                JOptionPane.showMessageDialog(this, "Please enter ticket rates correctly to add event");
            } else {
                Event event = new Event();
                event.setName(this.tfEventName.getText());
                str = this.tfStartDate.getText() + " " + this.tfStartTime.getText();
                try {
                    event.setBeginDateTime(StringHelper.strTotime(str));
                } catch (ParseException ex) {
                    Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                }
                str = "";
                str = this.tfEndDate.getText() + " " + this.tfEndTime.getText();
                try {
                    event.setEndDateTime(StringHelper.strTotime(str));
                } catch (ParseException ex) {
                    Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                }
                event.setDescription(this.taDescription.getText());
                Venue venue = (Venue) this.cbVenue.getSelectedItem();
                event.setVenueID(venue.getVenueID());
                event.setCancelled(false);
                event.setType(this.tfType1.getText());
                event.setKeywords(this.tfKeyword.getText());
                event.setPrice(getprice());
                EventController eventcont = new EventController();
                newid = eventcont.addEvent(event);
                if (newid != 0) {
                    event.setEventID(newid);
                    JOptionPane.showMessageDialog(this, "Event added Successfully!!");
                } else {
                    JOptionPane.showMessageDialog(this, "Error adding event");
                }
                if (TicketRateobj(event)) {
                    JOptionPane.showMessageDialog(this, "TicketRate added successfully");
                } else {
                    eventcont.deleteEvent(event);
                    JOptionPane.showMessageDialog(this, "Error adding TicketRate");
                }
            }
        } catch (ParseException ex) {
            Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_bAddActionPerformed

    public boolean comparedates() throws ParseException
    {
        if(StringHelper.before(StringHelper.strTonewtime(this.tfStartDate.getText() + " " +this.tfStartTime.getText()),
                StringHelper.strTonewtime(this.tfEndDate.getText() + " " + this.tfEndTime.getText())))
            return true;
        else
            return false;

    }

    private boolean compareschedule() throws ParseException
    {
     
     Venue venue = (Venue) this.cbVenue.getSelectedItem();
     Event event = new Event();
     event.setVenueID(venue.getVenueID());
     boolean flag = true;
     EventController ec = new EventController();
     Collection<Event> events = ec.getEvents(event);
     for(Event eventobj : events)
     {

         if(StringHelper.timerange(eventobj.getBeginDateTime(),eventobj.getEndDateTime(),
                 StringHelper.strTonewtime(this.tfStartDate.getText() + " " +this.tfStartTime.getText())
                 ,StringHelper.strTonewtime(this.tfEndDate.getText() + " " + this.tfEndTime.getText())))
                 flag = false;

          
     }

     return flag;
    }

    private boolean validateTicketRate()
    {
        boolean breturn = true;

        if(this.ffA.getText().isEmpty() && this.ffB.getText().isEmpty() && this.ffC.getText().isEmpty()
                && this.ffD.getText().isEmpty() && this.ffE.getText().isEmpty())
        {
            JOptionPane.showMessageDialog(this, "Please enter atleast one ticket rate price");
            breturn = false;
        }

        if(this.ckbA.isVisible() && !this.ffA.getText().isEmpty())
        {
            if(StringHelper.limitone(this.ffA.getText()))
            {
                JOptionPane.showMessageDialog(this, "Please enter a reasonable price for A");
                this.ffA.setText("");
                breturn = false;
            }
            
        }
         if(this.ckbB.isVisible() && !this.ffB.getText().isEmpty())
        {
            if(StringHelper.limitone(this.ffB.getText()))
            {
                JOptionPane.showMessageDialog(this, "Please enter a reasonable price for B");
                this.ffB.setText("");
                breturn = false;
            }

        }
         if(this.ckbC.isVisible() && !this.ffC.getText().isEmpty())
        {
            if(StringHelper.limitone(this.ffC.getText()))
            {
                
                JOptionPane.showMessageDialog(this, "Please enter a reasonable price for C");
                this.ffC.setText("");
                breturn = false;
            }

        }
         if(this.ckbD.isVisible() && !this.ffD.getText().isEmpty())
        {
            
            if(StringHelper.limitone(this.ffD.getText()))
            {
                JOptionPane.showMessageDialog(this, "Please enter a reasonable price for D");
                this.ffD.setText("");
                breturn = false;
            }

        }
        if(this.ckbE.isVisible() && !this.ffE.getText().isEmpty())
        {
            if(StringHelper.limitone(this.ffE.getText()))
            {
                JOptionPane.showMessageDialog(this, "Please enter a reasonable price for E");
                this.ffE.setText("");
                breturn = false;
            }

        }
        

        if(breturn)
        {
            if(this.ckbA.isVisible() && !this.ffA.getText().isEmpty())
            {
                try
                {
                    if (Double.parseDouble(this.ffA.getText()) < 0)
                    {
                        JOptionPane.showMessageDialog(this, "A price can't be negative");
                        breturn = false;
                    }
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid price entered in A");
                    ffA.setText("");
                    breturn = false;
                }
            }

            if(this.ckbB.isVisible() && !this.ffB.getText().isEmpty())
            {
                try
                {
                    if (Double.parseDouble(this.ffB.getText()) < 0)
                    {
                        JOptionPane.showMessageDialog(this, "B price can't be negative");
                        breturn = false;
                    }

                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid price entered in B");
                    ffB.setText("");
                    breturn = false;
                }
            }

            if(this.ckbC.isVisible() && !this.ffC.getText().isEmpty())
            {
                try
                {
                    if (Double.parseDouble(this.ffC.getText()) < 0)
                    {
                        JOptionPane.showMessageDialog(this, "C price can't be negative");
                        breturn = false;
                    }

                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid price entered in C");
                    ffC.setText("");
                    breturn = false;
                }
            }

            if(this.ckbD.isVisible() && !this.ffD.getText().isEmpty())
            {
                try
                {
                    if (Double.parseDouble(this.ffD.getText()) < 0)
                    {
                        JOptionPane.showMessageDialog(this, "C price can't be negative");
                        breturn = false;
                    }
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid price entered in D");
                    ffD.setText("");
                    breturn = false;
                }
            }

            if(this.ckbE.isVisible() && !this.ffE.getText().isEmpty())
            {
                try
                {
                    if (Double.parseDouble(this.ffE.getText()) < 0)
                    {
                        JOptionPane.showMessageDialog(this, "C price can't be negative");
                        breturn = false;
                    }
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid price entered in E");
                    ffE.setText("");
                    breturn = false;
                }
            }

        }

        return breturn;

    }

    private String getprice()
    {
        String price = "";
        
        if(!this.ffA.getText().isEmpty())
        {
            price = price+"A: $"+this.ffA.getText();
        }

        if(!this.ffB.getText().isEmpty())
        {
            price = price+" B: $"+this.ffB.getText();
        }

        if(!this.ffC.getText().isEmpty())
        {
            price = price+" C: $"+this.ffC.getText();
        }

        if(!this.ffD.getText().isEmpty())
        {
           price = price+" D: $"+this.ffD.getText();
        }

        if(!this.ffE.getText().isEmpty())
        {
            price = price+" E: $"+this.ffC.getText();
        }

        return price;
    }

    private boolean TicketRateobj(Event event)
    {
        boolean result = true;
        TicketRateController tcon = new TicketRateController();
        TicketRate trate = new TicketRate();
        if(!this.ffA.getText().isEmpty())
        {
            trate.setEventID(event.getEventID());
            trate.setSeatCategoryID(1);
            trate.setVenueID(event.getVenueID());
            trate.setPrice(Double.parseDouble(this.ffA.getText()));
            if(!tcon.addTicketRate(trate))
                result = false;
        }

        if(result && !this.ffB.getText().isEmpty())
        {
            trate.setEventID(event.getEventID());
            trate.setSeatCategoryID(2);
            trate.setVenueID(event.getVenueID());
            trate.setPrice(Double.parseDouble(this.ffB.getText()));
            if(!tcon.addTicketRate(trate))
                result = false;
        }
  
        if(result && !this.ffC.getText().isEmpty())
        {
            trate.setEventID(event.getEventID());
            trate.setSeatCategoryID(3);
            trate.setVenueID(event.getVenueID());
            trate.setPrice(Double.parseDouble(this.ffC.getText()));
            if(!tcon.addTicketRate(trate))
                result = false;
        }

        if(result && !this.ffD.getText().isEmpty())
        {
            trate.setEventID(event.getEventID());
            trate.setSeatCategoryID(4);
            trate.setVenueID(event.getVenueID());
            trate.setPrice(Double.parseDouble(this.ffD.getText()));
            if(!tcon.addTicketRate(trate))
                result = false;
        }

        if(result && !this.ffE.getText().isEmpty())
        {
            trate.setEventID(event.getEventID());
            trate.setSeatCategoryID(5);
            trate.setVenueID(event.getVenueID());
            trate.setPrice(Double.parseDouble(this.ffE.getText()));
            if(!tcon.addTicketRate(trate))
                result = false;
        }

        return result;
    }
    private void cbVenueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbVenueActionPerformed
        // TODO add your handling code here:

            this.ckbA.setVisible(false);
            this.ckbB.setVisible(false);
            this.ckbC.setVisible(false);
            this.ckbD.setVisible(false);
            this.ckbE.setVisible(false);

            this.ffA.setText("");
            this.ffB.setText("");
            this.ffC.setText("");
            this.ffD.setText("");
            this.ffE.setText("");

            this.ffA.setVisible(false);
            this.ffB.setVisible(false);
            this.ffC.setVisible(false);
            this.ffD.setVisible(false);
            this.ffE.setVisible(false);

            if(this.cbVenue.getSelectedItem().equals(""))
                return;
        Venue venue = (Venue) this.cbVenue.getSelectedItem();
        Seat seat = new Seat();
        seat.setVenueID(venue.getVenueID());
        SeatController seatcon = new SeatController();
        Collection<Seat> seatCollection = seatcon.getAllSeat(seat);


        for(Seat seatItem : seatCollection)
        {
            if(seatItem.getSeatCategoryID() == 1)
            {
                this.ckbA.setVisible(true);
                this.ffA.setVisible(true);
            }

            if(seatItem.getSeatCategoryID() == 2)
            {
                this.ckbB.setVisible(true);
                this.ffB.setVisible(true);
            }

            if(seatItem.getSeatCategoryID() == 3)
            {
                this.ckbC.setVisible(true);
                this.ffC.setVisible(true);
            }


            if(seatItem.getSeatCategoryID() == 4)
            {
                this.ckbD.setVisible(true);
                this.ffD.setVisible(true);
            }

            if(seatItem.getSeatCategoryID() == 5)
            {
                this.ckbE.setVisible(true);
                this.ffE.setVisible(true);
            }
        }

    }//GEN-LAST:event_cbVenueActionPerformed

    //add venue part
    //PART B
   
   private boolean validateSeat()
    {
        boolean theReturn;
        int t = 1 ; //for tracing how many seat category is choosen
        //label for A,B,C,D,E,check empty number
        //start of validate seat ,empty part
       theReturn = true ;
            //the end of validate seat ,empty part 
            if((theReturn == true)&&(this.ffA1.isVisible()) &&(!this.ffA1.getText().isEmpty()))
            {
                try
                {
                     int  temp =  Integer.parseInt(this.ffA1.getText());
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Must be a number ! Invalid seat number for A");
                    ffA1.setText("");
                    ffA1.requestFocus();
                    theReturn = false;
                }
            }

            if((theReturn == true)&&(this.ffB1.isVisible()) &&(!this.ffB1.getText().isEmpty()))
            {
                try
                {
                    int  temp =  Integer.parseInt(this.ffB1.getText());
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid seat number for B");
                    ffB1.setText("");
                    ffB1.requestFocus();
                    theReturn = false;
                }
            }

            if((theReturn == true)&&(this.ffC1.isVisible()) &&(!this.ffC1.getText().isEmpty()))
            {
                try
                {
                     int  temp =  Integer.parseInt(this.ffC1.getText());
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid seat number for C");
                    ffC1.setText("");
                    ffC1.requestFocus();
                    theReturn = false;
                }
            }

            if((theReturn == true)&&(this.ffD1.isVisible()) &&(!this.ffD1.getText().isEmpty()))
            {
                try
                {
                   int  temp =  Integer.parseInt(this.ffD1.getText());
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid seat number for D");
                    ffD1.setText("");
                    ffD1.requestFocus();
                    theReturn = false;
                }
            }

            if((theReturn == true)&&(this.ffE1.isVisible()) &&(!this.ffE1.getText().isEmpty()))
            {
                try
                {
                    int  temp =  Integer.parseInt(this.ffE1.getText());
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(this, "Invalid seat number for E");
                    ffE1.setText("");
                    ffE1.requestFocus();
                    theReturn = false;
                }
            }

     //   }
    if(theReturn == true)
    {
        //check valid length
       if((theReturn == true)&& (this.ffA1.isVisible()) && (!this.ffA1.getText().isEmpty()))
        {
           if(ffA1.getText().length()>11)
           {
               JOptionPane.showMessageDialog(this, "Invalid length for A");
               ffA1.requestFocus();
               ffA1.setText("");
           }
        }
           //check valid length
       if((theReturn == true)&& (this.ffB1.isVisible()) && (!this.ffB1.getText().isEmpty()))
        {
           if(ffB1.getText().length()>11)
           {
               JOptionPane.showMessageDialog(this, "Invalid length for B");
               ffB1.requestFocus();
               ffB1.setText("");
           }
        }
            //check valid length
       if((theReturn == true)&& (this.ffC1.isVisible()) && (!this.ffC1.getText().isEmpty()))
        {
           if(ffC1.getText().length()>11)
           {
               JOptionPane.showMessageDialog(this, "Invalid length for C");
               ffC1.requestFocus();
               ffC1.setText("");
           }
        }
        if((theReturn == true)&& (this.ffD1.isVisible()) && (!this.ffD1.getText().isEmpty()))
        {
           if(ffD1.getText().length()>11)
           {
               JOptionPane.showMessageDialog(this, "Invalid length for D");
               ffD1.requestFocus();
               ffD1.setText("");
           }
        }
        if((theReturn == true)&& (this.ffE1.isVisible()) && (!this.ffE1.getText().isEmpty()))
        {
           if(ffE1.getText().length() > 11)
           {
               JOptionPane.showMessageDialog(this, "Invalid length for E");
               ffE1.requestFocus();
               ffE1.setText("");
           }
        }
      }
      if((ffA1.getText().isEmpty())&&(ffB1.getText().isEmpty())&&(ffC1.getText().isEmpty())&&(ffD1.getText().isEmpty())&&(ffE1.getText().isEmpty())){
          JOptionPane.showMessageDialog(this,"You must enter at least one seatcategory!") ;
          ffA1.requestFocus() ;
          theReturn = false ;
      }

        return theReturn;
   }
     

  //THE END OF PART B
    private boolean seatNumberobj(Venue venue)
    {
       boolean result = true;
        SeatNumberController scon = new SeatNumberController() ;
        if(!this.ffA1.getText().isEmpty())
        {
            Seat mySeat = new Seat() ;
            mySeat.setVenueID(venue.getVenueID());
            mySeat.setSeatCategoryID(1);//the number has already verified ,but we can double check it
            mySeat.setNumberOfSeats (Integer.parseInt(this.ffA1.getText()));//the number has already verified ,but we can double check it
            if(scon.addSeatNumber(mySeat) == false) {result = false;}
          
        }


        if(result && !this.ffB1.getText().isEmpty())
        {

            Seat mySeat = new Seat() ;
            mySeat. setVenueID (venue.getVenueID());
            mySeat.setSeatCategoryID(2);
            mySeat.setNumberOfSeats (Integer.parseInt(this.ffB1.getText()));//the number has already verified ,but we can double check it
            if(scon.addSeatNumber (mySeat)== false){ result = false;}
        }

        if(result && !this.ffC1.getText().isEmpty())
        {
            Seat mySeat = new Seat() ;
            mySeat. setVenueID (venue.getVenueID());
            mySeat.setSeatCategoryID(3);
            mySeat.setNumberOfSeats (Integer.parseInt(this.ffC1.getText()));//the number has already verified ,but we can double check it
            if(scon. addSeatNumber(mySeat)== false){result = false;}
        }

        if(result && !this.ffD1.getText().isEmpty())
        {
            Seat mySeat = new Seat() ;
            mySeat. setVenueID (venue.getVenueID());
            mySeat.setSeatCategoryID(4);
            mySeat.setNumberOfSeats (Integer.parseInt(this.ffD1.getText()));//the number has already verified ,but we can double check it
            if(scon.addSeatNumber(mySeat) == false ){ result = false;}
        }

        if(result && !this.ffE1.getText().isEmpty())
        {
            Seat mySeat = new Seat() ;
            mySeat. setVenueID (venue.getVenueID());
            mySeat.setSeatCategoryID(5);
            mySeat.setNumberOfSeats (Integer.parseInt(this.ffE1.getText()));//the number has already verified ,but we can double check it
            if(scon.addSeatNumber(mySeat) == false){ result = false;}
        }

        return result;
    }


    


//end of add venue function

    private void bGenerateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bGenerateActionPerformed
        // TODO add your handling code here:

        if(this.cbBase.getSelectedItem().equals(""))
            JOptionPane.showMessageDialog(this, "Please select Report Base");
        else if(this.lsSelect.getSelectedIndex() == -1 && this.cbBase.getSelectedItem().equals("Event") )
            JOptionPane.showMessageDialog(this, "Please select an Event");
        else if(this.lsSelect.getSelectedIndex() == -1 && this.cbBase.getSelectedItem().equals("Venue") )
            JOptionPane.showMessageDialog(this, "Please select a Venue");
        else if(this.lsSelect.getSelectedIndex() == -1 && this.cbBase.getSelectedItem().equals("Customer") )
            JOptionPane.showMessageDialog(this, "Please select a Customer");
        else if(this.lsSelect.getSelectedIndex() == -1 && this.cbBase.getSelectedItem().equals("Location") )
            JOptionPane.showMessageDialog(this, "Please select a Location");
        else if(this.cbFrequency.getSelectedItem().equals(""))
            JOptionPane.showMessageDialog(this, "Please select report type");
        else if(this.cbFrequency.getSelectedItem().equals("Custom") && !StringHelper.isValidDate(this.tffrom.getText()))
        {
             JOptionPane.showMessageDialog(this, "From Date is invalid");
        }
        else if(this.cbFrequency.getSelectedItem().equals("Custom") && !StringHelper.isValidDate(this.tfto.getText()))
        {
             JOptionPane.showMessageDialog(this, "To Date is invalid");
        }
        else try {
            if (this.cbFrequency.getSelectedItem().equals("Custom") && !compare()) {
                JOptionPane.showMessageDialog(this, "From date greater than to date");
            } else {
                if (this.cbFrequency.getSelectedItem().equals("Custom")) {
                    try {
                        generate_custom_report();
                    } catch (SQLException ex) {
                        Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                    }
                } else {
                    try {
                        generate_report();
                    } catch (SQLException ex) {
                        Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        } catch (ParseException ex) {
            Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
        }
                
    }//GEN-LAST:event_bGenerateActionPerformed

    public boolean compare() throws ParseException
    {
        if(StringHelper.before(StringHelper.strTonewdate(this.tffrom.getText()),
                StringHelper.strTonewdate(this.tfto.getText())))
            return true;
        else
            return false;

    }
    public void generate_report() throws SQLException
    {
        int num_of_cols = 0;
        int col1 = 0, col2 = 0,col3 = 0,col4 = 0;

        if(this.cbBase.getSelectedItem().equals("Event") && this.cbFrequency.getSelectedItem().equals("Daily"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Day");
            vheader.addElement("Event Name");
            vheader.addElement("Total Sales");
            
            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] eventObjects = this.lsSelect.getSelectedValues();
            Event[] event = new Event[eventObjects.length];
            for(int i=0; i<eventObjects.length; i++)
            {
                event[i] = (Event) eventObjects[i];
            }

            
            result = bkcon.getEventday(event);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this event selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
              this.lbReport.setText("            EVENT DAILY REPORT");
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Event") && this.cbFrequency.getSelectedItem().equals("Yearly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Year");
            vheader.addElement("Event Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] eventObjects = this.lsSelect.getSelectedValues();
            Event[] event = new Event[eventObjects.length];
            for(int i=0; i<eventObjects.length; i++)
            {
                event[i] = (Event) eventObjects[i];
            }

            result = bkcon.getEventyear(event);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this event selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              num_of_cols = 3;
              this.lbReport.setText("            EVENT YEARLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Event") && this.cbFrequency.getSelectedItem().equals("Monthly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Month");
            vheader.addElement("Year");
            vheader.addElement("Event Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] eventObjects = this.lsSelect.getSelectedValues();
            Event[] event = new Event[eventObjects.length];
            for(int i=0; i<eventObjects.length; i++)
            {
                event[i] = (Event) eventObjects[i];
            }

            result = bkcon.getEventmonth(event);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this event selection");
            }
            else
            {
              col1 = 100;
              col2 = 100;
              col3 = 350;
              col4 = 150;
              num_of_cols = 4;
              this.lbReport.setText("            EVENT MONTHLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Event") && this.cbFrequency.getSelectedItem().equals("All"))
        {
            Vector<String> vheader = new Vector<String>();
            
            vheader.addElement("Event Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] eventObjects = this.lsSelect.getSelectedValues();
            Event[] event = new Event[eventObjects.length];
            for(int i=0; i<eventObjects.length; i++)
            {
                event[i] = (Event) eventObjects[i];
            }
            
            result = bkcon.getAlltime(event);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this event selection");
            }
            else
            {
              col1 = 400;
              col2 = 300;
              num_of_cols = 2;
              this.lbReport.setText("            EVENT ALL TIME REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Venue") && this.cbFrequency.getSelectedItem().equals("Monthly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Month");
            vheader.addElement("Year");
            vheader.addElement("Venue Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] venueObjects = this.lsSelect.getSelectedValues();
            Venue[] venue = new Venue[venueObjects.length];
            for(int i=0; i<venueObjects.length; i++)
            {
                venue[i] = (Venue) venueObjects[i];
            }

            result = bkcon.getVenuemonth(venue);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this venue selection");
            }
            else
            {
              col1 = 100;
              col2 = 100;
              col3 = 350;
              col4 = 150;
              num_of_cols = 4;
              this.lbReport.setText("            VENUE MONTHLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
              
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Venue") && this.cbFrequency.getSelectedItem().equals("Daily"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Day");
            vheader.addElement("Venue Name");
            vheader.addElement("Total Sales");
            
            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();


            Object[] venueObjects = this.lsSelect.getSelectedValues();
            Venue[] venue = new Venue[venueObjects.length];
            for(int i=0; i<venueObjects.length; i++)
            {
                venue[i] = (Venue) venueObjects[i];
            }

            result = bkcon.getVenueDay(venue);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this venue selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;

              num_of_cols = 3;
              this.lbReport.setText("            VENUE DAILY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);

            }
        }
        else if(this.cbBase.getSelectedItem().equals("Venue") && this.cbFrequency.getSelectedItem().equals("Yearly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Year");
            vheader.addElement("Venue Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] venueObjects = this.lsSelect.getSelectedValues();
            Venue[] venue = new Venue[venueObjects.length];
            for(int i=0; i<venueObjects.length; i++)
            {
                venue[i] = (Venue) venueObjects[i];
            }

            result = bkcon.getVenueYear(venue);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this venue selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;

              num_of_cols = 3;
              this.lbReport.setText("            VENUE YEARLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);

            }
        }
        else if(this.cbBase.getSelectedItem().equals("Location") && this.cbFrequency.getSelectedItem().equals("Yearly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Year");
            vheader.addElement("Location Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] locatObjects = this.lsSelect.getSelectedValues();
            String[] locat = new String[locatObjects.length];
            for(int i=0; i<locatObjects.length; i++)
            {
                locat[i] = (String) locatObjects[i];
            }
            result = bkcon.getLocationYear(locat);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this Location selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              this.lbReport.setText("            LOCATION YEARLY REPORT");
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Location") && this.cbFrequency.getSelectedItem().equals("Monthly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Month");
            vheader.addElement("Year");
            vheader.addElement("Location Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] locatObjects = this.lsSelect.getSelectedValues();
            String[] locat = new String[locatObjects.length];
            for(int i=0; i<locatObjects.length; i++)
            {
                locat[i] = (String) locatObjects[i];
            }
            result = bkcon.getLocationMonth(locat);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this Location selection");
            }
            else
            {
              col1 = 100;
              col2 = 100;
              col3 = 350;
              col4 = 150;
              num_of_cols = 4;
              this.lbReport.setText("            LOCATION MONTHLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Location") && this.cbFrequency.getSelectedItem().equals("Daily"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Day");
            vheader.addElement("Location Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] locatObjects = this.lsSelect.getSelectedValues();
            String[] locat = new String[locatObjects.length];
            for(int i=0; i<locatObjects.length; i++)
            {
                locat[i] = (String) locatObjects[i];
            }
            result = bkcon.getLocationDay(locat);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this Location selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;

              num_of_cols = 3;
              this.lbReport.setText("             LOCATION DAILY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Customer") && this.cbFrequency.getSelectedItem().equals("Yearly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Year");
            vheader.addElement("First Name");
            
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] custObjects = this.lsSelect.getSelectedValues();
            Customer[] cust = new Customer[custObjects.length];
            for(int i=0; i<custObjects.length; i++)
            {
                cust[i] = (Customer) custObjects[i];
            }
            result = bkcon.getCustomeryear(cust);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this customer selection");
            }
            else
            {

              col1 = 100;
              col2 = 400;
              col3 = 200;

              num_of_cols = 3;
              this.lbReport.setText("             CUSTOMER YEARLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Customer") && this.cbFrequency.getSelectedItem().equals("Monthly"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Month");
            vheader.addElement("Year");
            vheader.addElement("First Name");
            
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] custObjects = this.lsSelect.getSelectedValues();
            Customer[] cust = new Customer[custObjects.length];
            for(int i=0; i<custObjects.length; i++)
            {
                cust[i] = (Customer) custObjects[i];
            }

            result = bkcon.getCustomermonth(cust);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this customer selection");
            }
            else
            {
              col1 = 100;
              col2 = 100;
              col3 = 350;
              col4 = 150;
              num_of_cols = 4;
              this.lbReport.setText("             CUSTOMER MONTHLY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Customer") && this.cbFrequency.getSelectedItem().equals("Daily"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Day");
            vheader.addElement("First Name");
            
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] custObjects = this.lsSelect.getSelectedValues();
            Customer[] cust = new Customer[custObjects.length];
            for(int i=0; i<custObjects.length; i++)
            {
                cust[i] = (Customer) custObjects[i];
            }
            result = bkcon.getCustomerday(cust);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this customer selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;

              num_of_cols = 3;
              this.lbReport.setText("             CUSTOMER DAILY REPORT");
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        
    }



    public void generate_custom_report() throws SQLException
    {
        int num_of_cols = 0, col1 = 0, col2=0, col3 =0, col4 =0;
        String from = this.tffrom.getText();
        String to = this.tfto.getText();

        if(this.cbBase.getSelectedItem().equals("Event"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Date");
            vheader.addElement("Event Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            
            Object[] eventObjects = this.lsSelect.getSelectedValues();
            Event[] event = new Event[eventObjects.length];
            for(int i=0; i<eventObjects.length; i++)
            {
                event[i] = (Event) eventObjects[i];
            }

            result = bkcon.getEventRange(event, from, to);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this event selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              this.lbReport.setText("             EVENT CUSTOM REPORT");
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Customer"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Date");
            vheader.addElement("First Name");
            vheader.addElement("Total Sales");
            

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();

            Object[] custObjects = this.lsSelect.getSelectedValues();
            Customer[] cust = new Customer[custObjects.length];
            for(int i=0; i<custObjects.length; i++)
            {
                cust[i] = (Customer) custObjects[i];
            }
            result = bkcon.getCustomerRange(cust, from, to);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this customer selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              this.lbReport.setText("             CUSTOMER CUSTOM REPORT");
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Venue"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Date");
            vheader.addElement("Venue Name");
            vheader.addElement("Total Sales");


            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] venueObjects = this.lsSelect.getSelectedValues();
            Venue[] venue = new Venue[venueObjects.length];
            for(int i=0; i<venueObjects.length; i++)
            {
                venue[i] = (Venue) venueObjects[i];
            }

            result = bkcon.getVenueRange(venue, from, to);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this venue selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              this.lbReport.setText("             VENUE CUSTOM REPORT");
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Location"))
        {
            Vector<String> vheader = new Vector<String>();
            vheader.addElement("Date");
            vheader.addElement("Location Name");
            vheader.addElement("Total Sales");

            Vector result = new Vector();
            BookedTicketViewController bkcon = new BookedTicketViewController();
            Object[] locatObjects = this.lsSelect.getSelectedValues();
            String[] locat = new String[locatObjects.length];
            for(int i=0; i<locatObjects.length; i++)
            {
                locat[i] = (String) locatObjects[i];
            }

            result = bkcon.getLocationRange(locat, from, to);
            if(result.isEmpty())
            {
              JOptionPane.showMessageDialog(this, "No sales for this Location selection");
            }
            else
            {
              col1 = 100;
              col2 = 400;
              col3 = 200;
              this.lbReport.setText("             LOCATION CUSTOM REPORT");
              num_of_cols = 3;
              setResultTable(result,vheader, num_of_cols, col1, col2, col3, col4);
            }
        }

    }

    public void setResultTable(Vector rowdata, Vector header, int num_of_cols, int col1, int col2, int col3,int col4)
    {
        if(this.jScrollPane2!=null)
            jPanel4.remove(jScrollPane2);

        jScrollPane2 = new javax.swing.JScrollPane();
        jScrollPane3 = new javax.swing.JScrollPane();

        DefaultTableModel model = new DefaultTableModel(rowdata, header)
        {
            @Override
            public boolean isCellEditable(int rowIndex, int mColIndex)
            {
                return false;
            }
        };
        
        tbResult = new javax.swing.JTable(model);

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N
        
        this.tbResult = new JTable(rowdata, header);

        
        // Disable auto resizing
        tbResult.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        // Set the first visible column to 100 pixels wide int vColIndex = 0;
        TableColumn coln1 = tbResult.getColumnModel().getColumn(0);
        TableColumn coln2 = tbResult.getColumnModel().getColumn(1);

        coln1.setPreferredWidth(col1);
        coln2.setPreferredWidth(col2);

        if(num_of_cols >= 3)
        {
         TableColumn coln3 = tbResult.getColumnModel().getColumn(2);
         coln3.setPreferredWidth(col3);
        }
        
        if(num_of_cols == 4)
        {
            TableColumn coln4 = tbResult.getColumnModel().getColumn(3);
            coln4.setPreferredWidth(col4);

        }

        jScrollPane3.setViewportView(tbResult);

        jScrollPane2.setViewportView(jScrollPane3);
        
        jPanel4.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 90, 650, 450));

        this.validate();
        this.repaint();

    }
    
    private void cbBaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbBaseActionPerformed
        // TODO add your handling code here:
        if(this.cbBase.getSelectedItem().equals("Event"))
        {
            this.cbFrequency.removeAllItems();
            this.cbFrequency.addItem("");
            this.cbFrequency.addItem("Daily");
            this.cbFrequency.addItem("Monthly");
            this.cbFrequency.addItem("Yearly");
            this.cbFrequency.addItem("Custom");
            this.cbFrequency.addItem("All");

        }
        else
        {
            this.cbFrequency.removeAllItems();
            this.cbFrequency.addItem("");
            this.cbFrequency.addItem("Daily");
            this.cbFrequency.addItem("Monthly");
            this.cbFrequency.addItem("Yearly");
            this.cbFrequency.addItem("Custom");

        }
        if(this.cbBase.getSelectedItem().equals("Venue"))
        {
            this.cbSelect.removeAllItems();
            //this.cbSelect.addItem("");
            this.lbSelect.setText("VENUE LIST");
            VenueController vc = new VenueController();
            Collection<Venue> venues = vc.getAllVenues();
            for(Venue venue : venues)
            {
                this.cbSelect.addItem(venue);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Event"))
        {
           
            this.cbSelect.removeAllItems();
           // this.cbSelect.addItem("");
            this.lbSelect.setText("EVENT LIST");
            EventController ec = new EventController();
            Collection<Event> events = ec.getAllEvents();
            for(Event event : events)
            {
                this.cbSelect.addItem(event);
            }
                   
        }
        else if(this.cbBase.getSelectedItem().equals("Customer"))
        {
            this.cbSelect.removeAllItems();
            this.lbSelect.setText("CUSTOMER LIST");
            //this.cbSelect.addItem("");
            CustomerController cc = new CustomerController();
            Collection<Customer> customers = cc.getAllCustomers();

            for(Customer cust : customers)
            {
                this.cbSelect.addItem(cust);
            }
        }
        else if(this.cbBase.getSelectedItem().equals("Location"))
        {
            this.cbSelect.removeAllItems();
            this.lbSelect.setText("LOCATION LIST");
            //this.cbSelect.addItem("");
            BookedTicketViewController bkcon = new BookedTicketViewController();
            RowSet rs = bkcon.getLocation();

           
            try {
                while (rs.next()) {
                    this.cbSelect.addItem(rs.getString(1));
                }
            } catch (SQLException ex) {
                Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        else
        {
            this.cbSelect.removeAllItems();
            this.lbSelect.setText("");
            this.lbReport.setText("");
        }

    }//GEN-LAST:event_cbBaseActionPerformed
  private void initAddVenue()
  {
      //add venue part
        this.lb1.setVisible(true);
        this.lb2.setVisible(false);
        this.lb3.setVisible(false);
        this.lb4.setVisible(false);
        this.lb5.setVisible(false);
        this.ffA1.setVisible(true);
        this.ffB1.setVisible(false);
        this.ffC1.setVisible(false);
        this.ffD1.setVisible(false);
        this.ffE1.setVisible(false);
        this.ffA1.setText("");
        this.ffB1.setText("");
        this.ffC1.setText("");
        this.ffD1.setText("");
        this.ffE1.setText("");
        this.tfVenueName.setText("") ;
        this.tfVenueLocation.setText("");
        this.tfVenueType.setText("") ;
        traceSeatCategory = 1 ; //to trace how many seat category is selected ,1 is the default value
  }

    
    // add event data to event combobox in cancel event taggle
    private void initCancelEventComponent()
    {
        EventController eventContorller = new EventController();
        Collection<Event> eventDO = eventContorller.getAllEvents();
        for(Event event: eventDO)
        {
            if(!event.isCancelled())
                cmbEvent.addItem(event.getName());
        }
        cmbEvent.setSelectedIndex(0);
    }

    private void btnCancelEventActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelEventActionPerformed
        // TODO add your handling code here:
        cancelEvent();
        cmbEvent.removeAllItems();
        reloadEvents();
    }//GEN-LAST:event_btnCancelEventActionPerformed

    private void cancelEvent()
    {

        Collection<Integer> custIDList = new ArrayList<Integer>();
        Event tempEvent = new Event();
        tempEvent.setName((String) this.lscnEvent.getSelectedValue());
        Collection<Event> events = DAOFactory.getInstance().getEventDAO().getEventsDO(tempEvent);
        if(events.size() != 0)
        {
            Iterator<Event> eventIter = events.iterator();
            while(eventIter.hasNext())
            {
                Event event = eventIter.next();
                event.setCancelled(true);
                //event.setName((String) this.lscnEvent.getSelectedValue());
                event.setName(event.getName().replaceAll("'", "''"));
                DAOFactory.getInstance().getEventDAO().updateEvent(event);

                Order order = new Order();
                order.setEventID(event.getEventID());
                Collection<Order> orders = DAOFactory.getInstance().getOrderDAO().getOrdersDO(order);
                Iterator<Order> orderIter = orders.iterator();
                while(orderIter.hasNext())
                {
                    Order tempOrd = orderIter.next();
                    int customerID = tempOrd.getCustomerID();
                    if(custIDList.isEmpty() || !custIDList.contains(customerID))
                    {
                        custIDList.add(customerID);
                        double cost = tempOrd.getCost();

                        Bankcard bankcard = new Bankcard();
                        bankcard.setCustomerID(customerID);
                        DAOFactory.getInstance().getBankcardDAO().findBankcard(bankcard);
                        bankcard.setBalance(bankcard.getBalance() + cost);

                        Customer customer = new Customer();
                        customer.setCustomerID(customerID);
                        DAOFactory.getInstance().getCustomerDAO().findCustomer(customer);

                        PremiumCustomer pc = new PremiumCustomer();
                        pc.setCustomerID(customerID);
                        if(DAOFactory.getInstance().getPremiumCustomerDAO().findPremiumCustomer(pc) != null)
                            pc.setPoints(pc.getPoints() - (int)cost/5);

                        List<String> emailaddr = new ArrayList<String>();
                        emailaddr.add(customer.getEmailAddress());
                        Email email = new Email();
                        email.setEmailAddress(emailaddr);
                        email.setSubject("Refund Notice");
                        email.setMessage("Dear " + customer.getLastName() + ", We have refunded " + cost +
                            " to your bank card because event " + event.getName() + "has been cancelled");
                        try
                        {
                            EmailSender emailSender = new EmailSender();
                            emailSender.sendSSLMessage(email);
                        }
                        catch(AddressException ex)
                        {
                            Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        catch(MessagingException ex)
                        {
                            Logger.getLogger(AdministratorHomeView.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    }
                }
            }         
        JOptionPane.showMessageDialog(null, "Event has been cancalled", "Cancel events", JOptionPane.INFORMATION_MESSAGE);
        }
    }
    
    private void reloadEvents()
    {
        EventController eventContorller = new EventController();
        Collection<Event> eventDO = eventContorller.getAllEvents();
        for(Event event: eventDO)
        {
            if(!event.isCancelled())
                cmbEvent.addItem(event.getName());
        }
        cmbEvent.setSelectedIndex(0);
    }

private void bAddVenueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddVenueActionPerformed
// TODO add your handling code here:
       String str;
        int newid;
       
        //validate if empty
        if(this.tfVenueName.getText().equals("") || this.tfVenueLocation.getText().equals("") || this.tfVenueType.getText().equals("") ) //check if any textfield is empty  //reminder : the Venue Type should be an integer
        {
            JOptionPane.showMessageDialog(this, "All fields are mandatory.");
        }
        //PART 1
        
         else if(!StringHelper.validateString(this.tfVenueName.getText())) //text field venue name , but it did not validate if the event/venue name has existed
        {
            JOptionPane.showMessageDialog(this, "Invalid characters in Name"); //did you validate if the input is an integer ?
            tfVenueName.setText("");
            tfVenueName.requestFocus();
        }
        else if(!StringHelper.validateString(this.tfVenueLocation.getText())) //text field venue name , but it did not validate if the event/venue name has existed
        {
            JOptionPane.showMessageDialog(this, "Invalid characters in Location"); //did you validate if the input is an integer ?
            tfVenueLocation.setText("");
            tfVenueLocation.requestFocus();
        }
        else if(!StringHelper.isValidNumber(this.tfVenueType.getText()))
        {
            JOptionPane.showMessageDialog(this, "VenueType is invalid!It must be a number !");
            tfVenueType.setText("");
            tfVenueType.requestFocus();
        }
        //check length for each field
        else if(this.tfVenueName.getText().length() > 45)
        {
            JOptionPane.showMessageDialog(this, "Invalid length in Name field!Must be in 1-45 characters!");
            tfVenueName.setText("");
            tfVenueName.requestFocus();

        }
        else if(this.tfVenueLocation.getText().length() > 45)
        {
            JOptionPane.showMessageDialog(this, "Invalid length in Location field!Must be in 1-45 characters!");
            tfVenueLocation.setText("");
            tfVenueLocation.requestFocus();
        }
        else if(this.tfVenueType.getText().length()> 11 )
        {
            JOptionPane.showMessageDialog(this, "Invalid length in Type filed!Must be in 1-11 characters!");
            tfVenueType.setText("");
            tfVenueType.requestFocus();
        }
        else if(!validateSeat())
        {
           // JOptionPane.showMessageDialog(this, "There is a/many error in seat number part!Please check it again!");
        }
         
        //THE END OF PART1
       else
      {
         
         Venue venue = new Venue();
         venue.setName(this.tfVenueName.getText());    // call the method in venue.java
         venue.setLocation(this.tfVenueLocation.getText());
         venue.setType(Integer.parseInt(this.tfVenueType.getText()));
          //insert venue into venue table ,using VenueController class ,remember to complete those two methods in VenueController
         VenueController venueContent = new VenueController() ;
         //insert venue to database
         newid =  venueContent.addVenue(venue) ;   //give the new venue id to newid in order to insert seats into seat table

                if(newid != 0)
                {
                    venue.setVenueID(newid);     //connected to Venue.java which is a data object
                    JOptionPane.showMessageDialog(this, "Venue added Successfully!!");
                   //check for adding seat numbers for each category ,related with two methods : private seatNumberobj ,
                   if(seatNumberobj(venue) == true)
                   {
                        JOptionPane.showMessageDialog(this, "seat number is added successfully");

                    }
                    else
                   {
                        venueContent.deleteVenue(venue);
                        JOptionPane.showMessageDialog(this, "Error on  adding seats numbers");

                    }
                   
                }
                else
                {   JOptionPane.showMessageDialog(this, "Fail to add venue! The venue exists!");
                }
               
         }
}//GEN-LAST:event_bAddVenueActionPerformed

private void bAddSeatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddSeatActionPerformed
    // TODO add your handling code here:
    traceSeatCategory ++ ;
     if(traceSeatCategory == 1)
     {
         lb1.setVisible(true);
         ffA1.setVisible(true) ;
         ffA1.requestFocus();
     }
     else if(traceSeatCategory == 2)
     {
         lb2.setVisible(true);
         ffB1.setVisible(true) ;
         ffB1.requestFocus();
     }
     else if(traceSeatCategory == 3)
     {
         lb3.setVisible(true);
         ffC1.setVisible(true) ;
         ffC1.requestFocus();
     }
     else if(traceSeatCategory == 4)
     {
         lb4.setVisible(true);
         ffD1.setVisible(true) ;
         ffD1.requestFocus();
     }
     else if(traceSeatCategory == 5)
     {
         lb5.setVisible(true);
         ffE1.setVisible(true) ;
         ffE1.requestFocus();
     }
     else
     {
          JOptionPane.showMessageDialog(this, "No more Options!");
     }


}//GEN-LAST:event_bAddSeatActionPerformed

private void bResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bResetActionPerformed
    // TODO add your handling code here:
     tfVenueName.setText("");
     tfVenueLocation.setText("");
     tfVenueType.setText("");
     ffA1.setText("");
     ffB1.setText("");
     ffC1.setText("");
     ffD1.setText("");
     ffE1.setText("");
}//GEN-LAST:event_bResetActionPerformed

private void tfVenueNameFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfVenueNameFocusLost
    
}//GEN-LAST:event_tfVenueNameFocusLost

private void tfVenueLocationFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfVenueLocationFocusLost
  
}//GEN-LAST:event_tfVenueLocationFocusLost

private void tfVenueTypeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfVenueTypeFocusLost
   
}//GEN-LAST:event_tfVenueTypeFocusLost

private void ffA1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ffA1FocusLost
  

}//GEN-LAST:event_ffA1FocusLost

private void ffB1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ffB1FocusLost
  
}//GEN-LAST:event_ffB1FocusLost

private void ffC1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ffC1FocusLost
    

}//GEN-LAST:event_ffC1FocusLost

private void ffD1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ffD1FocusLost
  


}//GEN-LAST:event_ffD1FocusLost

private void ffE1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_ffE1FocusLost
  


}//GEN-LAST:event_ffE1FocusLost

private void cbFrequencyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbFrequencyActionPerformed
    // TODO add your handling code here:
    if(this.cbFrequency.getSelectedItem() == null)
    {
        
    }
    else if(this.cbFrequency.getSelectedItem().equals("Custom"))
    {
        this.tffrom.setText("");
        this.tfto.setText("");
        this.tffrom.setVisible(true);
        this.tfto.setVisible(true);
        this.lbFromdate.setVisible(true);
        this.lbTodate.setVisible(true);
        this.lbyy.setVisible(true);
        this.lbxx1.setVisible(true);
    }
    else
    {
        this.tffrom.setVisible(false);
        this.tfto.setVisible(false);
        this.lbFromdate.setVisible(false);
        this.lbTodate.setVisible(false);
        this.lbyy.setVisible(false);
        this.lbxx1.setVisible(false);
    }
}//GEN-LAST:event_cbFrequencyActionPerformed

private void ffB1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ffB1ActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_ffB1ActionPerformed

private void btResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btResetActionPerformed
    // TODO add your handling code here:
    this.tfEndDate.setText("");
    this.tfEventName.setText("");
    this.tfEndTime.setText("");
    this.tfStartDate.setText("");
    this.tfStartTime.setText("");
    this.tfKeyword.setText("");
    this.tfType1.setText("");
    this.taDescription.setText("");
    this.ffA.setText("");
    this.ffB.setText("");
    this.ffC.setText("");
    this.ffD.setText("");
    this.ffE.setText("");
    
}//GEN-LAST:event_btResetActionPerformed
 
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AdministratorHomeView().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bAdd;
    private javax.swing.JButton bAddSeat;
    private javax.swing.JButton bAddVenue;
    private javax.swing.JButton bGenerate;
    private javax.swing.JButton bReset;
    private javax.swing.JButton btReset;
    private javax.swing.JButton btnCancelEvent;
    private javax.swing.JComboBox cbBase;
    private javax.swing.JComboBox cbFrequency;
    private javax.swing.JComboBox cbSelect;
    private javax.swing.JComboBox cbVenue;
    private javax.swing.JLabel ckbA;
    private javax.swing.JLabel ckbB;
    private javax.swing.JLabel ckbC;
    private javax.swing.JLabel ckbD;
    private javax.swing.JLabel ckbE;
    private javax.swing.JComboBox cmbEvent;
    private javax.swing.JTextField ffA;
    private javax.swing.JTextField ffA1;
    private javax.swing.JTextField ffB;
    private javax.swing.JTextField ffB1;
    private javax.swing.JTextField ffC;
    private javax.swing.JTextField ffC1;
    private javax.swing.JTextField ffD;
    private javax.swing.JTextField ffD1;
    private javax.swing.JTextField ffE;
    private javax.swing.JTextField ffE1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lb1;
    private javax.swing.JLabel lb2;
    private javax.swing.JLabel lb3;
    private javax.swing.JLabel lb4;
    private javax.swing.JLabel lb5;
    private javax.swing.JLabel lbBase;
    private javax.swing.JLabel lbDescription;
    private javax.swing.JLabel lbEndDate;
    private javax.swing.JLabel lbEndTime;
    private javax.swing.JLabel lbEventName;
    private javax.swing.JLabel lbFrequency;
    private javax.swing.JLabel lbFromdate;
    private javax.swing.JLabel lbKeyword;
    private javax.swing.JLabel lbReport;
    private javax.swing.JLabel lbSelect;
    private javax.swing.JLabel lbStartDate;
    private javax.swing.JLabel lbStartTime;
    private javax.swing.JLabel lbTodate;
    private javax.swing.JLabel lbType1;
    private javax.swing.JLabel lbVenue;
    private javax.swing.JLabel lbcn;
    private javax.swing.JLabel lbdisplay1;
    private javax.swing.JLabel lbdisplay2;
    private javax.swing.JLabel lbdisplay3;
    private javax.swing.JLabel lbdisplay4;
    private javax.swing.JLabel lbxx1;
    private javax.swing.JLabel lbyy;
    private javax.swing.JList lsSelect;
    private javax.swing.JList lscnEvent;
    private javax.swing.JTextArea taDescription;
    private javax.swing.JFormattedTextField tfEndDate;
    private javax.swing.JFormattedTextField tfEndTime;
    private javax.swing.JTextField tfEventName;
    private javax.swing.JFormattedTextField tfKeyword;
    private javax.swing.JFormattedTextField tfStartDate;
    private javax.swing.JFormattedTextField tfStartTime;
    private javax.swing.JFormattedTextField tfType1;
    private javax.swing.JTextField tfVenueLocation;
    private javax.swing.JTextField tfVenueName;
    private javax.swing.JTextField tfVenueType;
    private javax.swing.JTextField tffrom;
    private javax.swing.JTextField tfto;
    // End of variables declaration//GEN-END:variables
 
  
  
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable tbResult;
  


    private void initDropDownList()
    {
        VenueController vc = new VenueController();
        Collection<Venue> venues = vc.getAllVenues();
        for(Venue venue : venues)
        {
            this.cbVenue.addItem(venue);
        }
    }


}
